<?php
namespace BoojasrFramework\Controller;

use BoojasrFramework\Response\JsonResponse;
use BoojasrFramework\Response\ViewResponse;


abstract class AbstractController
{
    /**
     * Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
     *
     * @final
     */
    protected function json($data, int $status = 200, array $headers = []): JsonResponse
    {

        return new JsonResponse($data, $status, $headers);
    }

    /**
     * @param $view
     * @param $data
     * @return ViewResponse
     */
    protected function view($view,$data):ViewResponse
    {
        return new ViewResponse($view,$data);
    }
}
